<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>News - SCMS</title>
    <link rel="stylesheet" type="text/css" href="lib/bootstrap/dist/css/bootstrap.css">
</head>

<body ng-app="webapp">
    <div class="container" ng-controller="NewsController">
        <h2>News</h2>
        <button class="btn btn-primary btn-sm" ng-click="createNews()">Create News</button>
        <!-- 新闻列表 -->
        <div class="row" ng-repeat="news in list">
            <div class="col-sm-2">
                <small ng-bind="formatTime(news.createTime)"></small>
            </div>
            <div class="col-sm-2">
                <a href="javascript:void(0)" ng-click="openNewsDetail(news._id)">{{news.title}}</a>
            </div>
            <div class="col-sm-8">
                {{news.content}}
            </div>
        </div>
        <!-- 新闻详情 -->
        <div class="modal fade" id="modal-detail">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 ng-bind="current.title"></h4>
                        <span ng-bind="formatTime(current.createTime)"></span>
                    </div>
                    <div class="modal-body">
                        <div ng-bind="current.content"></div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 创建新闻 -->
        <div class="modal fade" id="modal-editor">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4>News Editor</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-horizontal">
                            <div form-group>
                                <label class="col-sm-2 control-label">Title</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" ng-model="news.title" placeholder="News Title"/>
                                </div>
                            </div>
                            <div form-group>
                                <label class="col-sm-2 control-label">Content</label>
                                <div class="col-sm-10">
                                    <textarea type="text" class="form-control" ng-model="news.content" placeholder="News Content" cols="50" rows="6"></textarea>
                                </div>
                            </div>
                            <div form-group>
                                <div class="col-sm-offset-2 col-sm-10">
                                    <button class="btn btn-primary  btn-sm" ng-click="save()">Save</button>
                                    <button type="button" class="btn btn-default  btn-sm" data-dismiss="modal">Close</button>
                                    <span class="help-inline text-danger" ng-bind="editorMessage"></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript" src="lib/angular/angular.js"></script>
    <script type="text/javascript" src="lib/jquery/dist/jquery.js"></script>
    <script type="text/javascript" src="lib/bootstrap/dist/js/bootstrap.js"></script>
    <script type="text/javascript" src="lib/moment/moment.js"></script>
    <script type="text/javascript" src="webapp.js"></script>
    <script type="text/javascript" src="service/news.client.service.js"></script>
    <script type="text/javascript" src="controllers/news.client.controller.js"></script>
</body>

</html>